home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / misc / speak_ez.lzh / heythere.c next >
C/C++ Source or Header  |  1990-09-27  |  2KB  |  76 lines

  1. /*
  2.        heythere.c
  3.  
  4.            written by:
  5.         Randy Hosler    26 SEP 1990
  6.         randyh@hpsadpk
  7.  
  8.        adapted from code written by:
  9.         Steve Bate, November 1986
  10.         ARPA: smb.mdc@office-1.arpa
  11.             AURA BBS: (314) 928-0598  (ST BBS, 20 Meg of downloads)
  12. */
  13.  
  14. #include <stdio.h>
  15. #include <osbind.h>
  16.  
  17. main (argc,argv)
  18. int argc;
  19. char *argv[];
  20. {
  21.     long base;
  22.     
  23.     base = Pexec(3, "stspeech.tos", NULL, NULL);    
  24.     if (base < 0) exit(1);
  25.  
  26.     speak("hay there, world", base);
  27. }
  28.  
  29.  
  30. /* speak function - takes pointer to char for text to speak 
  31.    and long for base address of stspeech.tos                */
  32.  
  33. long _STKSIZ = 4096L;
  34.  
  35. char rts[2] = {0x4e,0x75};
  36.  
  37. speak(speechin, base)
  38. char *speechin;
  39. long base;
  40. {
  41.     register char *program,*buffer;
  42.  
  43.     program = (char *)(base + 0x100);
  44.  
  45.     strncpy(program + 0x0e,rts,2);
  46.     strncpy(program + 0x6c,rts,2);
  47.  
  48.     buffer = program + 0x6eee;
  49.  
  50.     strcpy(buffer+2, speechin);
  51.        *buffer = 0xfe;
  52.        *(buffer+1) = (char)strlen(buffer+2)-1;
  53.  
  54.        /* 
  55.           STSPEECH will respeak the last line if the current
  56.           input line is a '\n'. The '\n' is replaced by a 
  57.       space to defeat this redundant speech on double spaced
  58.           files.
  59.        */
  60.  
  61.        if (!*(buffer+1)) strncpy(buffer+1,"\1 \0",3);
  62.  
  63.        asm("movem.l    a4-a6,-(sp)");
  64.        asm("move.l    a3,-(sp)");
  65.        asm("jsr    50(a3)");
  66.        asm("move.l    (sp),a3");
  67.        asm("jsr    136(a3)");
  68.        asm("move.l    (sp)+,a3");
  69.        asm("movem.l    (sp)+,a4-a6");
  70.  
  71.        buffer = program + 0x6eee;
  72.  
  73. }
  74.    
  75.     
  76.